package com.weir.myproject.controller_TestDemo;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author weir
 *
 */

@RestController
public class TestController01 {
	@RequestMapping(value="test01")
    String home() {
        return "欢迎访问测试，厉害我的SpringBoot...";
    }
	@RequestMapping(value="test02/{message}")
    String echo01(@PathVariable("message") String msg) {
        return "使用@RequestMapping注解获取参数:"+msg;
    }
	@RequestMapping(value="test03")
	String echo02(String msg) {
		return "使用@RequestMapping注解获取参数:"+msg;
	}
	@RequestMapping(value="test04")
	String echo03(Integer msg) {
		return "msg的数值类型："+msg;
	}
	@RequestMapping(value="test05")
	String echo04(Integer val) {
		return "val计算："+val*10;
	}
	/**
	 * 添加数组类型
	 * @param val
	 * @return
	 */
	@RequestMapping(value="test06")
	String echo06(Integer[] val) {
		return "val:"+Arrays.toString(val);
	}
	@RequestMapping(value="test07")
	String echo07(@DateTimeFormat(iso=ISO.DATE)Date day) {
		return "val:"+day;
	}
}
